home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Tools - Objects / Macintosh Programmer’s Workshop / MPW QR4 / SADE 1.3b1 / sade.help < prev    next >
Text File  |  1991-04-25  |  83KB  |  2,459 lines

  1. SADE 1.3 Help Summaries
  2.  
  3.     Help summaries are available for each of the SADE commands.    
  4.     To see the list of commands enter "Help Commands". In addition, 
  5.     brief descriptions of Variables, Constants, Expressions, built
  6.     in functions, and Shortcuts are also included.
  7.  
  8.     To see Help summaries, Enter a command such as
  9.  
  10.     Help Builtins        # a list of builtin (predefined) variables and functions
  11.     Help commandName    # information about commandName
  12.     Help Commands        # a list of commands
  13.     Help Expressions    # summary of expressions
  14.     Help Patterns        # summary of patterns (regular expressions)
  15.     Help Shortcuts        # summary of SADE shortcuts
  16.     Help Variables         # summary of variable references
  17.     Help Basetypes        # summary of basic types recognized by SADE
  18.  
  19.     Copyright Apple Computer, Inc. 1987-1990
  20.     All rights reserved.
  21.  
  22. -    
  23. Builtins
  24.  
  25.     Functions
  26.         AddrToSource    # tries to display source for a particular code address
  27.         Concat             # concatenate strings
  28.         Confirm            # confirmation dialog
  29.         Copy             # extract a substring from a string
  30.         Eval            # evaluate the contents of a string
  31.         Find            # find pattern in memory
  32.         Length             # length of a string
  33.         NaN             # SANE NaN (Not a Number)
  34.         Request            # request dialog returning string
  35.         SizeOf             # size of a value or type
  36.         SourceToAddr    # tries to give code address for a point in a source file
  37.         Timer            # "tick count" timer with conversion to minutes,seconds,hundreths
  38.         TypeOf             # type (name) of a value
  39.         Undef             # is a value undefined?
  40.         Where             # symbolic representation of an address
  41.     
  42.     Variables
  43.         Arg[n]             # n'th parameter to current Proc or Func
  44.         ActiveWindow    # string with pathname of topmost SADE window
  45.         Date            # string with current date in the form dd-mmm-yy
  46.         DisAsmFormat    # string controlling format of DisAsm command output
  47.         Exception         # number of last exception raised
  48.         Inf             # SANE infinity
  49.         NArgs             # number of actual parameters to current Proc or Func
  50.         ProcessId         # id of current process being debugged (an integer)
  51.         TargetWindow    # string with pathname of the SADE window below the topmost one
  52.         Time            # string with current time in the form hh:mm:ss
  53.         WorksheetWindow    # string with pathname of SADE Worksheet window
  54.  
  55. -    
  56. Commands
  57.  
  58.     Abort             Execute         Macro            Shutdown
  59.     AddMenu           Find            MoveWindow       SizeWindow
  60.     Alert             For             OnEntry          SourcePath
  61.     Beep              Func            Open             Stack
  62.     Begin             Go              Printf           Step
  63.     Break             Heap            Proc             Stop
  64.     Case              Help            Quit             Target
  65.     Close             If              Redirect         Trace
  66.     Cycle             Kill            Repeat           Unbreak
  67.     Define            Launch          Resource         Undefine
  68.     DeleteMenu        Leave           Return           Untrace
  69.     Directory         List            SadeKey          Version
  70.     Disasm            Loop            Save             While
  71.     Dump                                               WindowSize
  72.  
  73. Functions
  74.  
  75.     AddrToSource      Eval            Request          Timer
  76.     Concat            Find            Selection        TypeOf
  77.     Confirm           Length          SizeOf           Undef
  78.     Copy              Nan             SourceToAddr     Where
  79. -
  80. Expressions
  81.  
  82.     The operators listed below are used in expressions in command
  83.     parameters. 
  84.  
  85.     (…)             grouping
  86.     
  87.     @                address of
  88.     †                trap expression
  89.     
  90.     ^                pointer to
  91.     .                variable reference qualifier
  92.  
  93.     -                unary negation
  94.     ~                bitwise ones complement
  95.     !     NOT  ¬     logical NOT (¬ is Option-L)
  96.  
  97.     *                multiplication
  98.     /     DIV  ÷        division (÷ is Option-/)
  99.     //     MOD        remainder
  100.  
  101.     +                addition
  102.     -                subtraction
  103.  
  104.     <<                shift left
  105.     >>                shift right
  106.  
  107.     =     ==            equal
  108.     <>   !=      ≠     not equal (≠ is Option-=)
  109.     <                less than
  110.     <=     ≤            less than or equal (≤ is Option-<)
  111.     >                greater than
  112.     >=     ≥            greater than or equal (≥ is Option->)
  113.  
  114.     &     AND        bitwise AND
  115.     &&                logical AND
  116.  
  117.     XOR     EOR        bitwise exclusive OR
  118.     |     OR            bitwise OR
  119.     ||                logical OR
  120.     
  121.     :=                size compatible assignment
  122.     <-                arbitrary assignment
  123.  
  124.     Alternate spellings of several operators are provided.
  125.     All of the operators are evaluated from left to right.
  126.     Operators with the highest precedence are listed first,
  127.     and operators in the same group have equal precedence.
  128.  
  129. -
  130. Patterns - Patterns specify characters to be matched.  Patterns may only be
  131.            used from the Find… command in the Find menu.
  132.  
  133.     /entireRE/                regular expression - search forward
  134.     \entireRE\                regular expression - search backward
  135.     
  136. entireRE
  137.  
  138.     •RE                     regular expression at beginning of line (Option-8)
  139.     RE∞                     regular expression at end of line (Option-5)
  140.     RE                        regular expression
  141.     
  142. RE
  143.  
  144.     simpleExpr                simple regular expression - defined below
  145.     'string'                literal - no characters within '…' are special
  146.     "string"                literal - only \, ∂, {, and ` are special within '…'
  147.     RE1RE2                    regular expression RE1 followed by RE2
  148.     
  149. simpleExpr
  150.     
  151.     (RE)                    regular expression grouping
  152.     charExpr                single character regular expression - defined below
  153.     simpleExpr*             simple expression zero or more times
  154.     simpleExpr+             simple expression one of more times
  155.     simpleExpr«n»            simple expression n times (Option-\, Option-Shift-\)
  156.     simpleExpr«n,»            simple expression at least n times
  157.     simpleExpr«n1,n2»        simple expression at least n1, at most n2 times
  158.     
  159. charExpr
  160.     
  161.     character                character (unless it has special meaning)
  162.     ∂character                character - defeats any special meaning (Option-D)
  163.     ?                        any character except Return
  164.     ≈                        zero or more characters, except Return (Option-X)
  165.     [charList]                any character in the list
  166.     [¬charList]             any character not in the list (Option-L)
  167.     
  168. charList
  169.  
  170.     ]                        ] first in the list represents itself
  171.     -                        - first in the list represents itself
  172.     character                character
  173.     charList character        list of characters
  174.     character-character     character range (e.g. A-Z)
  175.     
  176. -
  177. ShortCuts
  178.     The following is a list of SADE shortcuts:
  179.     
  180.     Double click        select word
  181.     Triple click        select line
  182.     Double clicking before any quote (', ", or `) will select until
  183.         the matching quote
  184.     Double clicking before or after {}[]() will select until
  185.         the matching character
  186.  
  187.     UpArrow             move selection point one line above current selection
  188.     DownArrow           move selection point one line below current selection
  189.     RightArrow          move selection point one character to the right
  190.     LeftArrow           move selection point one character to the left
  191.     
  192.     
  193.     CMD-Shift-UpArrow    select text from current selection point to top of screen
  194.     CMD-Shift-DownArrow    select text from current selection point to bottom of screen
  195.         
  196.         
  197.     CMD-Opt-UpArrow       move selection point to top of file
  198.     CMD-Opt-DownArrow     move selection point to bottom of file
  199.     CMD-DownArrow       move selection point down to bottom of screen
  200.     CMD-RightArrow      move selection point to right edge of current line
  201.     CMD-UpArrow         move selection point to top of screen
  202.     CMD-LeftArrow       move selection point to left edge of current line
  203.     CMD-Backspace       delete from current selection to end of file
  204.     
  205.     In Dialogs without an Edittext item
  206.         Y               Yes
  207.         N               No
  208.         CMD .           Cancel
  209.  
  210. -
  211. Variables
  212.     VARIABLE REFERENCES
  213.     
  214.     There are three different types of variables -- program variables, debugger
  215.     variables, and system variables.  Program variables are defined in your
  216.     program; debugger variables are defined during your debugging session; and
  217.     system variables represent objects in the Macintosh runtime environment 
  218.     (e.g., registers, low-memory globals, and ROM locations).
  219.     
  220.     When SADE looks up a simple symbol name, it is first looked up as a debugger
  221.     symbol, then as a program symbol, and finally as a system symbol.  Thus, if
  222.     the same name is used as a debugger symbol and as a program symbol the
  223.     debugger symbol will be returned.  In order to resolve such potential name
  224.     conflicts SADE supports two escape characters, which may preceed an 
  225.     identifier to indicate whether the identifier is a program or system symbol:
  226.         
  227.         ` (backquote) identifies a symbol as a program symbol
  228.         Δ (option j)  identifies a symbol as a system symbol
  229.     
  230.     PROGRAM VARIABLES
  231.     
  232.     The simplest form of program variable reference is just the name of the
  233.     variable itself.  A simple reference (a single identifier) is looked up
  234.     in the current name scope (CNS) as defined by where execution has stopped 
  235.     in the program.  If execution has stopped in a particular procedure, then 
  236.     the variables of that procedure and the global variables in the compilation
  237.     unit of that procedure will be accessible via simple references.
  238.     
  239.     If you need to reference a variable which is outside of the current name
  240.     scope (i.e., not in the procedure where execution has been suspended or
  241.     not one of the globals in the compilation unit of that procedure) then a
  242.     fully qualified reference is needed.  A fully qualified reference is very 
  243.     much like a complete file pathname describing how to get to the variable
  244.     from a particular compilation unit.  The syntax is:
  245.         
  246.         \unit [.procedure]* .variable
  247.         
  248.     where \ indicates that a unit name follows.  In Pascal this will be the name
  249.     on the UNIT or PROGRAM statement; in C or assembly this will be the name of
  250.     the compilation unit's file (with ∂'s used to escape any characters not
  251.     normally allowed in identifiers).  The [.procedure]* indicates zero or
  252.     more procedure names (more than one for nested procedures) separated by dots.
  253.     This will identify the path to a variable when it is not in the current CNS.
  254.     
  255.     DEBUGGER VARIABLES
  256.     
  257.     Debugger variables are defined with the DEFINE command.  These variables
  258.     can be used to save values from the user program, to control debugger
  259.     language contructs, etc.  Debugger variables are untyped, that is, they
  260.     take on the type of the value that is assigned to them (which may change
  261.     the next time they are assigned to).  The format of the define command is:
  262.     
  263.         Define [global] {declaration [':=' initialization]},…
  264.     
  265.     where
  266.           "declaration" is a variable name followed by an optional dimension
  267.             specification in square brackets, and
  268.         "initialization" is a simple expression in the case of a scalar
  269.             variable, or, an parenthesized list of expressions (separated by
  270.             commas) in the case of an array variable.  A list of values for
  271.             an array may include items of the form "n of v" where "n" is
  272.             an expression specifying a count and "v" is an expression specifying
  273.             a particular value.
  274.     
  275.     Any number of variables may be declared in a single DEFINE command.  The
  276.     DEFINE command is not allowed inside of conditional or looping constructs.
  277.     
  278.     Arrays/Scalars:
  279.         Scalar variables hold a value of any type.  An array variable will hold
  280.         up to its specified dimension of values of any type; these values may
  281.         be heterogeneous, that is, they need not be of the same type.
  282.     
  283.     Scope:
  284.         Variables which are defined outside of PROCs or FUNCs are global, and
  285.         are accessible both inside and outside of PROCs.  Variables which are
  286.         defined inside of PROCs and FUNCs are local and have a lifetime limited
  287.         to the particular activation of the PROC or FUNC, unless the optional
  288.         "global" keyword was specified in the DEFINE command.
  289.         
  290. -
  291. Basetypes
  292.  
  293.     The following basic types are recognized by SADE.  They are grouped in
  294.     order of increasing size or related category:
  295.     
  296.     Boolean            # 1 byte Pascal boolean (bit 0 = 0 ==> false; 1 ==> true)
  297.     UnsignedByte    # Unsigned byte
  298.     Byte            # Signed byte
  299.     Cchar            # Character byte
  300.  
  301.     UnsignedWord    # Unsigned word (2 bytes)
  302.     UnsignedShort    # Same as UnsignedWord
  303.     Word            # Signed word
  304.     Short            # Same as Word
  305.     Integer            # Same as Word
  306.     Pchar            # Pascal character word (low byte contains character)
  307.     PascalChar        # Same a Pchar
  308.  
  309.     UnsignedLong    # Unsigned long (4 bytes)
  310.     UnsignedInt        # Same as UnsignedLong
  311.     Long            # Signed long
  312.     Int                # Same as long
  313.     LongInt            # Same as Long
  314.  
  315.     PString            # Pascal variable length string
  316.     CString            # C null-terminated string
  317.     AsIsString        # As-is string (Packed array of char)
  318.  
  319.     Real            # Floating point single precision (4 bytes)
  320.     Float            # Same as Real
  321.     Single            # Same as Single
  322.     Double            # Floating point double precision (8 bytes)
  323.     Extended        # Floating point extended precision (10 bytes)
  324.     Extended12        # MC68881 floating point extended precision (12 bytes)
  325.     Comp[utational]    # Floating point computational integer (8 bytes)
  326. -
  327. Abort -stop break action and cancel pending commands
  328.  Syntax    
  329.      abort
  330.  
  331.  Description    
  332.      The Abort command terminates the current break action and returns you to SADE, 
  333.  canceling all pending commands. This means that if current execution is within 
  334.  a structured statement (Begin...End, for instance), or if multiple commands are 
  335.  selected, these pending commands are not executed. To terminate a break action 
  336.  without canceling pending commands, see the Stop command.
  337.  
  338.  Example    
  339.  #-- Establish target, suspending application
  340.  #-- and re-entering SADE at main.(1)
  341.   
  342.  directory 'VolName:some:path:toProg:'
  343.  target 'MyProg'
  344.  break \MyProg.main.(1)
  345.  launch 'MyProg'
  346.   
  347.  #-- Break action examines the current event type
  348.  #-- (assumes the event record is named myEvent)
  349.  #-- For mouseDown, show co-ordinates of mouseDown and stop.
  350.  #-- (Quitting break action but executing rest of pending SADE commmands)
  351.  #-- For keyDown, abort. (Quitting break action AND rest of commands)
  352.  #-- For any other event, show event type and continue executing
  353.  #-- (By default, break actions end with an implicit go)
  354.   
  355.  proc EventFilter
  356.    define global mouseAt;
  357.    if myEvent.what = 1 then    # mouseDown event
  358.      mouseAt := myEvent.where;
  359.      stop;
  360.    elseif myEvent.what = 3 # keyDown event
  361.      "keyDown"; abort;
  362.    else
  363.      printf "Event type %d: \n", myEvent.what;
  364.      printf;
  365.    end
  366.  end
  367.  
  368.  Begin
  369.    break _getNextEvent from applzone..applzone^ EventFilter
  370.    go
  371.    printf "Mouse down at H: %d\n          V: %d\n", mouseAt.h, mouseAt.v;
  372.  end
  373.   
  374. #-- output
  375.  
  376.  Event type 0:
  377.  Event type 8:
  378.  Event type 6:
  379.  Mouse down at H: 208
  380.                V: 144
  381.   
  382.  #-- with same break action in place, restart target.
  383.   
  384.  go
  385.   
  386.  #-- output
  387.   
  388.  Event type 6:
  389.  keyDown
  390.  
  391.  See also    Break, Stop 
  392. -
  393. AddMenu -create a menu or add menu items
  394.  Syntax    
  395.      addmenu [ menuname  [ itemname  [ command  ] ] ]
  396.  
  397.  Description    
  398.      The AddMenu command lets you create menus and add menu items to execute 
  399.  SADE commands. Menuname, itemname, and command are all string expressions 
  400.  and must be enclosed in quotation marks if they are string constants.
  401.      If a menu of menuname does not exist, a new menu is created. If a menu 
  402.  item with the specified itemname already exists, it's replaced; otherwise a 
  403.  new menu item is created. You can include a Command-key equivalent for the 
  404.  item by listing the command key after a slash (/) at the end of the string. 
  405.      If itemname or command are not specified, AddMenu returns the current value 
  406.  from the specified level down. For instance, if itemname is specified without 
  407.  any commands, AddMenu displays the command that's currently defined for that 
  408.  menu item. If menuname is omitted as well, SADE returns the current values for 
  409.  all user-defined menus and menu items.
  410.  
  411.  Examples    
  412.  
  413.  addmenu 'Debug' 'Disasm/1' 'disasm'
  414.  addmenu 'Debug' 'Code Resources' 'heap restype "CODE"'
  415.  
  416.  See also    DeleteMenu
  417.  
  418. -
  419. AddrToSource (addr [,bool])    
  420.     Returns 1 (true) or 0 (false) indicating whether it was able to display the
  421.  source (file) statement corresponding to a particular code address.  The 
  422.  optional boolean expression controls whether the window is brought up as the 
  423.  topmost (active) window.  The default (when the boolean is false or omitted) 
  424.  is for the source window to be displayed behind the topmost window (where the 
  425.  command with the AddrToSource function was likely to have been issued from).  
  426.      Note that source windows brought up by the AddrToSource function are read-only.
  427. -    
  428. Alert -display an alert box
  429.  Syntax    
  430.      alert [ beep ] message
  431.  
  432.  Description    
  433.      The Alert command displays an alert box containing the specified message. 
  434.  Message is a string expression and must be enclosed in quotes if it's a string 
  435.  constant. The alert is displayed until the OK button is clicked. If beep is 
  436.  specified, a sound is generated when the alert box appears.
  437.  
  438.  Example
  439.  
  440.  if length(str) > 64 then
  441.    alert "string longer than expected"
  442.  end 
  443.  
  444.  See also    Beep
  445. -    
  446. Beep -generate tones
  447.  Syntax    
  448.      beep [ notespecs ] 
  449.          where
  450.      notespecs is a string of the form 
  451.          [ note [,duration [,level ] ] ... ]
  452.  
  453.  Description    
  454.  For each notespec, the Beep command produces the given note for the specified 
  455.  duration and sound level. Multiple notespecs are separated by blanks or tabs. 
  456.  If no notespecs are given, a simple beep is produced.
  457.      Note is one of the following:
  458.          n    A number indicating the count field for the square wave generator,
  459.              as described in the Summary of the Sound Driver chapter of Inside
  460.              Macintosh.
  461.          n    A string in the following format:
  462.              [n ] letter [ # | b ] where n is an optional number indicating the
  463.              octaves below or above middle C, followed by a letter indicating
  464.              the note (A-G) and an optional sharp (#) or flat (b) character.
  465.              The optional duration is given in sixtieths of a second. The defualt
  466.              duration is 15 (one-quarter second).
  467.              The optional sound level is given as a number from 0 to 255. 
  468.              The default level is 128.
  469.  
  470.  Example    
  471.  
  472.  beep "2C,20 '2C#,40' 2D,60"
  473.   
  474.  #-- Play the 3 notes specified: C, C sharp, and D, all two octaves above
  475.  #-- middle C, for one-third, two-thirds, and one full second, 
  476.  #-- respectively. Note that the second parameter must be quoted;
  477.  #-- otherwise,the sharp character would indicate a comment.
  478.  
  479.  See also    Alert
  480. -
  481. Begin ...End -group commands
  482.  Syntax    
  483.      begin
  484.          commands
  485.      end
  486.  
  487.  Description    
  488.      The Begin...End construct allows a sequence of commands to be grouped 
  489.  together or bracketed. One use of this construct is to specify a breakpoint 
  490.  action consisting of multiple commands or procedure calls.
  491.  
  492.  Example
  493.  
  494.  break DisplayString.(4) begin
  495.    str := theStr^   # save value of parameter in variable str
  496.    if str = '***' then 
  497.      stop
  498.    end
  499.  end
  500. -
  501. Break -set breakpoints
  502.  Syntax    
  503.      break addr ,... [ break-action ]
  504.          or
  505.      break  trap [ from addr-range ] ,... [ break-action ]
  506.          or
  507.      break  trap-range [ from addr-range ] ,... [ break-action ]
  508.          or
  509.      break all traps  [ from addr-range ]  [ break-action ]
  510.         or
  511.     break class <classname>  [ break-action ]
  512.         or
  513.     break overload <functionname>  [ break-action ]
  514.  
  515.  Description    
  516.      The Break command sets one or more breakpoints within a target program's 
  517.  code. There are two types of breakpoints:  address breakpoints and trap 
  518.  breakpoints. Both kinds of breakpoints may be followed by a break action, 
  519.  a command (or series of commands) that's executed when the breakpoint is reached.
  520.      You can set an address breakpoint anywhere within your program by specifying 
  521.  a RAM address. You can also use symbolic references, in which case the code 
  522.  need not be in memory at the time the breakpoint is set. 
  523.      Trap breakpoints can be set on a single trap, a range of traps, or on all
  524.  traps. Traps can be specified by either trap name or trap number. Trap numbers 
  525.  must be prefixed with the trap character (*) and trap names must be preceded 
  526.  by an underscore (_InitGraf, for example). You can also specify a memory range, 
  527.  in which case SADE breaks only when the trap is called from the specified range.
  528.      The same trap may be specified in multiple break commands; you can use the 
  529.  List command to see what breakpoints have been set. When implementing trap 
  530.  breakpoints, SADE first looks for a call that matches a specified trap name, 
  531.  checking the address range if one was given. If no match is found, SADE then looks 
  532.  for trap ranges containing the trap. SADE takes the most recently defined range 
  533.  containing the trap, again checking the address range if one was specified.
  534.      Note: If you set an address break on an instruction that is a trap call for 
  535.  which a trap break has already been set, the address break is recognized and the 
  536.  trap break is not.
  537.      If a break action is specified, SADE resumes program execution after executing 
  538.  the command(s). There are two ways to suspend program execution as part of a 
  539.  break action. The Abort command returns to SADE immediately, canceling any pending 
  540.  commands. The Stop command executes any pending commands and then returns to SADE.
  541.      Warning:  The commands specified in the breakpoint action are saved
  542.  and are not interpreted until the breakpoint is reached. You should be sure 
  543.  that program symbol references will be correctly interpreted at the time the 
  544.  breakpoint is reached. In other words, a reference may be fine at the time you
  545.  define a break action, but be out of scope when the action is actually executed.
  546.      Note: If no break action is specified and the execution command (Go, for 
  547.  instance) just prior to hitting a breakpoint is part of a structured statement 
  548.  (such as While...End), or if multiple commands were selected, the remaining commands 
  549.  are executed after hitting the breakpoint and re-entering SADE.
  550.      You can specify multiple breakpoints, separated by commas, with a single Break 
  551.  command. If this command includes a break action at the end, the action is applied 
  552.  to all breaks on the list. 
  553.      The class keyword causes SADE to search for all symbols that match the C++
  554.  mangled pattern created for member functions of the specified class, and for
  555.  all symbols that match the Object Pascal method naming convention for the
  556.  specified class.  Breakpoints are then set on all routines that are named by
  557.  these symbols.
  558.      The overload keyword causes SADE to search for all symbols that match the
  559.  C++ mangled pattern created for functions of the specified name, and for all
  560.  symbols that match the Object Pascal method naming convention for the specified
  561.  function name.  Breakpoints are then set on all routines that are named by 
  562.  these symbols.
  563.  
  564.  Examples    
  565.  
  566.  break _GetResource
  567.  break *$A997..*$A9A0
  568.  break all traps from myproc.(1)..myproc.(5)
  569.  break all traps from applZone..applZone^
  570.   
  571.  #-- The following example sets multiple breakpoints.
  572.   
  573.  Break procB.(1), _LineTo from procA.(1)..procA.(1000), _setPort Begin;"hit one"; end
  574.  
  575.  list break
  576.    procB.(1)   # $586398  # processID =5  # has break action
  577.    _LineTo  # processID =5  # *$A891  # called from procA.(1) .. procA.(83)  # has
  578.  break action
  579.    _SetPort  # processID =5  # *$A873  # has break action
  580.   
  581.  #-- A break set on top of a matching breakpoint replaces the older one.
  582.  #-- Breakpoints match if they are set on the same address or trap and
  583.  #-- the called from address range, if there is one, matches.
  584.   
  585.  Break procB.(1)
  586.  break _lineTo
  587.  list break
  588.    procB.(1)   # $586398  # processID =5
  589.    _LineTo  # processID =5  # *$A891
  590.    _LineTo  # processID =5  # *$A891  # called from procA.(1) .. procA.(83)  # has
  591.  break action
  592.    _SetPort # processID =5  # *$A873  # has break action
  593.  
  594.  See also    Abort, List, Stop, Trace, Unbreak
  595. -
  596. Case -change case sensitivity
  597.  Syntax    
  598.      case on | off
  599.  
  600.  Description    
  601.      By default, case sensitivity is on, which means that when looking up symbols, 
  602.  SADE first performs a case-sensitive lookup. If the symbol isn't found, SADE 
  603.  converts all the characters to uppercase and looks again.
  604.      C programmers will want case sensitivity turned on. Pascal programmers, 
  605.  however, may want to set case sensitivity off; SADE then converts all symbols to 
  606.  uppercase before any lookup, speeding up the search process.
  607.  
  608.  Examples    
  609.  
  610.  #-- C programmers
  611.  
  612.  case on
  613.  
  614.  CFunction
  615.  CFunction.(0)
  616.  
  617.  CFUNCTION
  618.  ### Could not find "CFUNCTION" as a program symbol
  619.  
  620.  case off
  621.  
  622.  CFunction
  623.  ### Could not find "CFunction" as a program symbol
  624.   
  625.  #-- Pascal programmers
  626.   
  627.  case on
  628.   
  629.  PascalProc
  630.  PASCALPROC.(0)
  631.   
  632.  PASCALPROC
  633.  PASCALPROC.(0)
  634.   
  635.  case off
  636.   
  637.  PascalProc
  638.  PASCALPROC.(0)
  639. -
  640. Close -close a file
  641.  Syntax    
  642.      close [ all | windowName ]
  643.  
  644.  Description    
  645.      The Close command closes the specified file or all files.  WindowName is a 
  646.  string expression and must be enclosed in quotation marks if it's a string 
  647.  constant.
  648.      If no parameters are given, Close closes the target window. Note, however, 
  649.  that the SADE Worksheet file cannot be closed. If the contents of a file have 
  650.  not been saved, a dialog box asks whether they should be.
  651.  
  652.  Examples
  653.  
  654.  close 'myFile'
  655.  close targetWindow   #no quotes needed--uses SADE variable TargetWindow
  656. -
  657. Concat (str [,str…])    
  658.     Returns the concatenation of its string arguments.
  659. -
  660. Confirm (msg [,bool])    
  661.     Displays confirmation message in a dialog box and returns user response.
  662.  If the bool argument is omitted or if bool = 0, then Confirm presents an 
  663.  Ok/Cancel dialog, and returns 1 for Ok and 0 for Cancel.  If bool <> 0,
  664.  then Confirm presents a Yes/No/Cancel dialog and returns 1 for Yes, 0 for
  665.  No and -1 for Cancel.
  666. -
  667. Copy (str, start, length)    
  668.     Returns the substring of its first string argument, starting at the
  669.  specified character position, with the specified length.
  670. -
  671. Cycle -continue execution within construct
  672.  Syntax    
  673.      cycle  [ if  Boolean ]
  674.  
  675.  Description    
  676.      The Cycle command causes execution to continue from the conditional test 
  677.  of a While, Repeat, or For construct, or from the beginning of a Loop construct. 
  678.  If a Boolean expression is specified, Cycle executes only if the expression is 
  679.  nonzero; otherwise execution continues immediately following the Cycle command.
  680.  
  681.  Example    
  682.   
  683.  define testnum := 0
  684.  define endnum := 6
  685.  define cycleMax := 4
  686.   
  687.  repeat
  688.    printf "testNum = %d\n", testNum
  689.    testNum := testNum + 1
  690.    cycle if testNum < cycleMax
  691.    "\nDidn't cycle"
  692.  until testNum = endNum
  693.   
  694.  #-- output
  695.   
  696.  testNum = 0
  697.  testNum = 1
  698.  testNum = 2
  699.  testNum = 3
  700.   
  701.  Didn't cycle
  702.  testNum = 4
  703.   
  704.  Didn't cycle
  705.  testNum = 5
  706.   
  707.  Didn't cycle
  708.  
  709.  See also    Leave
  710. -
  711. Define -declare a SADE variable
  712.  Syntax    
  713.      define [ global ] declaration [,...]
  714.          where 
  715.     declaration has the form
  716.          name [ dimension ] [ := init-value | = init-value  ] 
  717.              where
  718.          name must be unique in the current scope unless declared global. 
  719.          dimension is an expr enclosed in brackets [ ]
  720.          init-value is either an expr for the initial value of simple types, or a
  721.          list of the following form for structured types:
  722.              ( [ expr of ] init-value , ..)
  723.              where the optional of clause allows for replication of a value.
  724.  
  725.  Description    
  726.      The Define command defines one or more SADE variables. A variable must be 
  727.  defined before it's used. The variable declaration identifies the name, scope, 
  728.  and (optionally) the initial value of the variable. Multiple declarations must 
  729.  be separated by commas. 
  730.      SADE variables are dynamically typed; that is, their type is determined
  731.  on assignment (and may be changed by new assignments). SADE variables defined 
  732.  as arrays require an index. SADE array variables may contain a heterogeneous set 
  733.  of values; that is, the elements may contain values of different types.
  734.      An initial value for simple types may optionally be specified by an expr
  735.  following the assignment operator (:=) or, in this case only, (=). If the
  736.  declared item is an array, a list of initial values may be specified as the
  737.  values of the array elements.
  738.      The scope of a variable can be either global or local. If a variable is
  739.  defined outside a procedure (or function), its scope is automatically global. 
  740.  In other words, it is known both inside and outside of any procedures. If a 
  741.  variable is declared inside a procedure, its scope is local unless the keyword 
  742.  global is given. If a global and a local variable exist with the same name, the 
  743.  local symbol overrides the global symbol.
  744.      Redefining global variables replaces the previous definition, with one
  745.  exception:  If the definition is within a procedure, and the new definition 
  746.  matches the existing definition, then the existing definition is retained. For 
  747.  example, when a global variable is defined within a procedure or function and 
  748.  is given an initial value, the initialization occurs only when the variable 
  749.  is actually created. Subsequent invocations of the procedure do not affect the 
  750.  current value of the global variable, and can make use of the value left in the 
  751.  variable by the preceding invocation.
  752.      The Define command may not be used within any structured statement. To remove 
  753.  a variable definition, use the Undefine command. 
  754.  
  755.  Examples    
  756.   
  757.  #-- define a five element array, with the first four elements true
  758.  #-- and the last element false
  759.  
  760.  define global test[5] := (4 of 1,0)
  761.  
  762.  #-- define a 30 element array, with the first 29 elements true
  763.  #-- and the last element false
  764.  
  765.  define arraysize := 30
  766.  define myArray[arraysize] := (arraysize-1 of 1,0]
  767.  
  768.  #-- In the next example, note that the definition of INDEX in
  769.  #-- RotateLeftOneWCarry() is local to that procedure; otherwise it
  770.  #-- would be attempting to redefine the global INDEX that's used
  771.  #-- as a FOR loop counter when RotateLeftOneWCarry() is called.
  772.  
  773.  proc RotateLeftOneWCarry()
  774.    define global SADEArray[4] := ("indexed by one", 2, 3.33, "fourth and last")
  775.    define index
  776.    define holder
  777.    for index := 1 to 4 do
  778.      if index = 1 then
  779.        holder := SADEArray[index]
  780.      else
  781.        SADEArray[index-1] := SADEArray[index]
  782.        if index = 4 then
  783.          SADEArray[index] := holder
  784.        end
  785.      end
  786.    end
  787.  end
  788.     
  789.  define index
  790.  define holder
  791.  for index := 1 to 4 do
  792.    RotateLeftOneWCarry()
  793.    for holder := 1 to 4 do
  794.      SADEArray[holder]
  795.    end
  796.    printf "\n"
  797.  end
  798.  undefine RotateLeftOneWCarry
  799.   
  800. #-- output
  801.   
  802.  2
  803.  3.33
  804.  fourth and last
  805.  indexed by one
  806.   
  807.  3.33
  808.  fourth and last
  809.  indexed by one
  810.  2
  811.   
  812.  fourth and last
  813.  indexed by one
  814.  2
  815.  3.33
  816.   
  817.  indexed by one
  818.  2
  819.  3.33
  820.  fourth and last
  821.  
  822.  See also    Undefine
  823. -
  824. DeleteMenu -delete menus or menu items
  825.  Syntax    
  826.      deletemenu [ menuname [ itemname ] ]
  827.  
  828.  Description    
  829.      The DeleteMenu command deletes menus and/or menu items.  Menuname and itemname 
  830.  are string expressions and must be enclosed in quotation marks if they are string 
  831.  constants. If only menuname is specified, the entire menu is deleted. If a 
  832.  user-defined menu item with the specified name exists, it is deleted. The 
  833.  standard SADE menus and menu items cannot be deleted. 
  834.      Warning:     If both menuname and itemname are omitted, all user-defined items 
  835.  are  deleted.
  836.  
  837.  Example
  838.  
  839.  deletemenu "Special" "Launchapp"
  840.  
  841.  See also    AddMenu
  842. -
  843. Directory -set or write the default directory
  844.  Syntax    
  845.      directory  [ directoryname ]
  846.  
  847.  Description    
  848.      When you first enter SADE, the default directory is the directory where
  849.  SADE resides. The Directory command sets the default directory for all SADE 
  850.  file-oriented operations to the specified directory.  Directoryname is a string 
  851.  expression and must be enclosed in quotation marks if it's a string constant. If 
  852.  directoryname isn't specified, the current default directory is displayed.
  853.  
  854.  Examples
  855.  
  856.  macro here "volume:very:long:directory:path"
  857.  directory here
  858.   
  859.  macro RootPath "volume:very:"
  860.  directory concat(RootPath, "long")
  861.  
  862.  See also    Sourcepath
  863. -
  864. Disasm -disassemble code
  865.  Syntax    
  866.      disasm  [ addr  [ count ] ]
  867.          or
  868.      disasm  [ addr-range ]
  869.  
  870.  Description    
  871.      The Disasm command disassembles instructions starting at the location 
  872.  specified by addr or addr-range. The default behavior when no address is 
  873.  specified is to begin disassembling at the end of the last disassembly. If 
  874.  the value of the program counter has changed since the last disassembly, the 
  875.  program counter (PC) is used as the default starting address. If no range or 
  876.  count is specified, the number of instructions (not lines) disassembled defaults 
  877.  to 20.
  878.      Each line of the disassembly output is divided into four fields:  the
  879.  module offset, the address of the instruction, the hexadecimal encoding for the 
  880.  instruction, and the assembly code (opcode, operand, and comment). You can modify 
  881.  the presence, order, and format of these fields by changing the value of the 
  882.  built-in variable DisAsmFormat (described in Chapter 3).
  883.  
  884.  Example
  885.  
  886.  #-- diassemble 5 instructions in standard format, starting at 
  887.  #-- the eighth statementof the DisplayText routine.
  888.  
  889.  disasm DisplayText.(8) 5
  890.  
  891.  #-- output
  892.  
  893.  DisplayText
  894.  +0040  003191A8  2F2D FE64   MOVE.L  -$019C(A5),-(A7)
  895.  +0044  003191AC  2F2D FE78   MOVE.L  -$0188(A5),-(A7)
  896.  +0048  003191B0  4EBA FE26   JSR     FlushDWindow   ; 00318FD8
  897.  +004C  003191B4  486D FE48   PEA     -$01B8(A5)
  898.  +0050  003191B8  4EBA 00C0   JSR     DisplayString  ; 0031927A
  899.  
  900.  See also    Dump
  901. -
  902. Dump -display memory
  903.  Syntax    
  904.      dump  [ byte | word | long ] [ addr  [ count ] ]
  905.          or
  906.      dump  [ byte | word | long ]  [ addr-range ]
  907.  Description    
  908.      The Dump command displays memory at the location specified by addr or
  909.  addr-range. If no parameter is given, the memory starting at the program counter 
  910.  is displayed. The memory is displayed in hexadecimal and ASCII characters 
  911.  according to the specified format, which may be byte, word, or long. The default 
  912.  format is word.
  913.      Remember that to dump the value of a variable "foo", you must specify
  914.  dump @foo (since dump foo would take foo's value and use it as an address).
  915.  
  916.  Examples    
  917.  
  918.  dump byte a5
  919.  $00146A8E 00 14 68 74 FF FF FF FF  00 00 00 00 00 00 00 00  ..ht............
  920.  dump word a5 40
  921.   
  922.  $00146A8E 0014 6874 FFFF FFFF  0000 0000 0000 0000  ..ht............
  923.  $00146A9E 000E 6C66 0000 FFFF  FFFF FFFF FFFF FFFF  ..lf............
  924.  $00146AAE 0001 4EF9 000E 6E00                       ..N...n.
  925.   
  926.  dump long a5..a5+40
  927.   
  928.  $00146A8E 00146874 FFFFFFFF  00000000 00000000  ..ht............
  929.  $00146A9E 000E6C66 0000FFFF  FFFFFFFF FFFFFFFF  ..lf............
  930.  $00146AAE 00014EF9 000E6E00  00                 ..N...n..
  931.  
  932.  See also    Disasm
  933. -
  934. Eval (str [,expr])    
  935.     Returns the value of the expression contained in its string argument.  If
  936.  an optional second argument is specified, it will be returned if Eval
  937.  encounters any errors in its evaluation; otherwise, if there was no second
  938.  argument errors during evaluation will be reported as usual (and will
  939.  terminate command processing).
  940.  
  941. Example
  942.  
  943. #-- The following line tells you that main.(0) is an addressable symbol
  944. eval('main.(0)')
  945. main.(0)
  946. #-- However, your program probably does not have xyz defined.
  947. eval('xyz.(0)')
  948. ### Could not find "xyz" as a program symbol
  949. #-- If you want to supress the error message, invoke eval with a second argument.
  950. #-- You can check for the second argument in a script.
  951. if eval('xyz.(0)','????') = '????' then
  952.     printf "Eval failed.\n"
  953. end
  954. Eval failed.
  955.  
  956. -
  957. Execute -execute commands in a file
  958.  Syntax    
  959.      execute filename
  960.  
  961.  Description    
  962.      The Execute command executes the commands and definitions contained in the 
  963.  specified file. Filename is a string expression and must be enclosed in 
  964.  quotation marks if it's a string constant. The Execute command can't be used 
  965.  within a structured statement.
  966.  
  967.  Example
  968.  
  969.  #-- In this example, the Redirect command creates a file to hold
  970.  #-- output from SADE. Entering a string echos the string. That 
  971.  #-- output is redirected to the file, becoming the file's contents.
  972.  #-- Here the string is a comment and a SADE command to execute
  973.  #-- the contents of the next file in the chain.
  974.   
  975.  open 'exec1'
  976.  redirect 'exec1'
  977.   
  978.    '"\n executing exec1 now"'
  979.    "execute 'exec2'"
  980.  
  981.    open "exec2"
  982.    redirect 'exec2'
  983.      "'now executing exec2'"
  984.      "execute 'exec3'"
  985.  
  986.      open "exec3"
  987.      redirect 'exec3'
  988.        '"Done in exec3"'
  989.  
  990.  redirect pop all
  991.  execute "exec1"
  992.   
  993.  Alert "Try a tile windows here\n_
  994.     Then look at the worksheet for output"
  995.   
  996.  #-- output
  997.   
  998.  executing exec1 now
  999.  now executing exec2
  1000.  Done in exec3
  1001. -
  1002. Find -search for a target
  1003.  Syntax    
  1004.      find [ count ] target [ ,n ] [ addr-range [ mask mask ] ] 
  1005.          or
  1006.     find [ count ] target [ ,n ]  [ addr [ count ] [ mask mask ] ]
  1007.  
  1008.  Description    
  1009.      The Find command searches memory for a target pattern, which can be 
  1010.  either a numeric or string expression. If you specify the count keyword, 
  1011.  Find tells you how many occurences of the target it found. If you omit the 
  1012.  count keyword, Find displays the address of the first occurrence of the pattern. 
  1013.  You can use the n parameter to specify which occurrence of the pattern you want; 
  1014.  for instance, if you specify 3 for n, Find returns the address of the third
  1015.  occurrence of the pattern.
  1016.      You may start the search at a specified addr and look up to count bytes 
  1017.  beyond, or you may limit the search to addr-range. The default range is the 
  1018.  MultiFinder block containing the application's heap and stack (in other words, 
  1019.  all of the memory that belongs to the application).
  1020.      The mask parameter (prefaced by the mask keyword) is an optional numeric or 
  1021.  string expression that is logically ANDed with the contents of each memory location 
  1022.  before the comparison is done.
  1023.      Important:    Remember that expression values in SADE are long words by 
  1024.  default; to specify another size, use typecasting, as shown below.
  1025.  
  1026.  Examples
  1027.  
  1028.  dump $20 $40
  1029.  $00000020 0027 A002 0027 A00A  0040 1F52 0027 A012  .'...'...@.R.'..
  1030.  $00000030 0027 A01A 0027 A032  0040 113C 0027 A02A  .'...'.2.@.<.'.*
  1031.  $00000040 0040 113C 0040 113C  0040 113C 0040 113C  .@.<.@.<.@.<.@.<
  1032.  $00000050 0040 113C 0040 113C  0040 113C 0040 113C  .@.<.@.<.@.<.@.<
  1033.   
  1034.  #-- Looking for the number of occurances of target,
  1035.  #-- from start address, for number of bytes.
  1036.  #-- Target is cast to word size. The default size would
  1037.  #-- be long and nothing in this range matches $0000113C.
  1038.   
  1039.  find COUNT (word)$113C $20 $40
  1040.  9
  1041.   
  1042. #-- Looking for first occurance of target, in address range.
  1043.  #-- C style type cast to limit the target to word size.
  1044.   
  1045.  find (word)$113C $20..$96
  1046.  $0000003A
  1047.   
  1048.  #-- Looking for second occurance of target.
  1049.  #-- Using Pascal style typecast on target.
  1050.   
  1051.  find word($113C), 2 $20 $40
  1052.  $00000042
  1053.   
  1054.  #-- Looking for a long.
  1055.  #-- Masking the memory searched prior to the compare.
  1056.   
  1057.  find $0000113C $20..$96 MASK $0000ffff
  1058.  $00000038
  1059.   
  1060.  #-- Match same last target with same last mask.
  1061.  #-- Just change the address range to search.
  1062.   
  1063.  find SAME $40..$50
  1064.  $00000040
  1065. -
  1066. For ...End -loop with a control variable
  1067.  Syntax    
  1068.      for clause [ do ]
  1069.          commands
  1070.     end 
  1071.          where clause may have one of the following forms:
  1072.      var := expr to expr
  1073.      var  := expr downto expr
  1074.      var := expr , ...
  1075.  
  1076.  Description    
  1077.      The For...End construct provides looping with a control variable.  The 
  1078.  enclosed commands are executed until the control variable has taken on each 
  1079.  successive value in the range expressed by clause.
  1080.      The control variable var must be declared before it can be used, and
  1081.  array variables are not allowed. For the clause expr to expr, the commands are 
  1082.  executed and the control value incremented once for every integer value in the 
  1083.  range. For the clause expr downto expr, the control value is decremented. The 
  1084.  third clause is a list of expressions; execution continues until the control 
  1085.  variable has taken the value of each of the listed expressions.
  1086.      For...End constructs may be nested; they may also be used within other 
  1087.  flow-control constucts, as well as in break actions. The control variable may 
  1088.  be modified within the body of the loop (but cannot, of course, be shared 
  1089.  between nested constructs).
  1090.  
  1091. Example
  1092.  
  1093.  define var := 0
  1094.  define outerLooper, syncopation
  1095.  for outerLooper := 3 downto 1 do
  1096.    "\n"
  1097.    for syncopation := "one","two","three", var
  1098.      printf "%d -- " , outerLooper
  1099.      syncopation
  1100.      var := var + 1
  1101.    end
  1102.  end
  1103.   
  1104.  #-- output
  1105.   
  1106.  3 -- one
  1107.  3 -- two
  1108.  3 -- three
  1109.  3 -- 0
  1110.   
  1111.  2 -- one
  1112.  2 -- two
  1113.  2 -- three
  1114.  2 -- 4
  1115.   
  1116.  1 -- one
  1117.  1 -- two
  1118.  1 -- three
  1119.  1 -- 8
  1120. -
  1121. Func ...End -define a SADE function
  1122.  Syntax    
  1123.      func  name  [ ( arg-name ,... ) ]
  1124.          commands
  1125.     end
  1126.  
  1127.  Description
  1128.      SADE functions are delimited by the Func...End construct. The last
  1129.  statement to be executed must be a Return command specifying a return value. 
  1130.  The type of a function is not specified in the definition but rather takes on 
  1131.  the type of the value returned. (Thus functions are not limited to returning 
  1132.  results of a single type.)
  1133.      SADE functions use conventional calling notation, with the function
  1134.  name followed by a list of parameters enclosed by parentheses. Function 
  1135.  parameters are handled in the same fashion as procedure parameters, and the 
  1136.  predefined SADE variables Arg and NArgs may be used. (See the description of 
  1137.  the Proc command for an example using these variables.)  User-defined functions 
  1138.  may be called anywhere an expression is allowed.
  1139.  
  1140.  Example
  1141.  
  1142.  func fact(n)
  1143.    if n <= 1.0 then
  1144.      return 1.0
  1145.    else
  1146.      return n * fact(n-1)
  1147.    end
  1148.  end
  1149.  
  1150.  See also    Proc, Return
  1151. -
  1152. Go -resume execution
  1153.  Syntax    
  1154.      go [ til addr ,...]
  1155.          or
  1156.      go [ while expr ]
  1157.          or
  1158.      go [ until expr ] 
  1159.  
  1160.  Description
  1161.      The Go command resumes program execution at the current program counter. 
  1162.  If you specify the keyword til, SADE sets a temporary breakpoint at the 
  1163.  specified address(es). When the breakpoint is encountered, SADE is reentered 
  1164.  and the breakpoint is removed. Note that if multiple breakpoints are specified 
  1165.  with the keyword til, all breakpoints are removed when any of them is reached.
  1166.      If the address is in ROM, SADE informs you that it can't set a breakpoint 
  1167.  in ROM. If a conditional expression is specified, SADE uses trace mode until the 
  1168.  condition is met (for the keyword until) or broken (for the keyword while).
  1169.  
  1170.  Examples
  1171.  
  1172.  go til \OtherCompilationUnit.myProc.(1)
  1173.  go while particularVar < 2
  1174.  go until ProgVar[1] = 3
  1175.  
  1176.  See also    Stop
  1177. -
  1178. Heap -display, check, or total heap information 
  1179.  Syntax    
  1180.      heap [ display ] [ addr ] [  blocktype  ]
  1181.     heap check [ addr ]
  1182.     heap totals [ addr ] [ blocktype ]
  1183.  
  1184.  Heap Display Description
  1185.      The Heap command displays information about the specified heap. You can 
  1186.  specify a heap that starts at addr; if no address is specified, the heap 
  1187.  pointed to by the global variable theZone is displayed. By default, this 
  1188.  information is displayed:
  1189.      •    a dot if the object is locked or nonrelocatable
  1190.      •    the block length
  1191.      •    the block type (relocatable, nonrelocatable, free)
  1192.      •    the address of the beginning of the block
  1193.      •    block attributes (locked, resource, purgeable)
  1194.      •    the address of the master pointer if it's a relocatable block
  1195.      •    for standard toolbox data structures, a description of the structure
  1196.      •    for a resource, the resource type and ID, and the reference number of 
  1197.          the file it's in
  1198.      You can specify one of the following blocktypes to limit the display to
  1199.  a particular type of block:
  1200.      •    purge[able] limits the display to purgeable blocks.
  1201.      •    nonreloc[atable] limits the display to nonrelocatable blocks. 
  1202.      •    reloc[atable] limits the display to relocatable blocks.
  1203.      •    free limits the display to free blocks. 
  1204.      •    lock[ed] limits the display to locked  blocks. 
  1205.      •    res[ource] limits the display to resources.
  1206.      •    restype type limits the display to the specified resource type.
  1207.      Note that type is case-sensitive and should be enclosed in single
  1208.  quotation marks ('MENU', for example).
  1209.  
  1210.  Example
  1211.  
  1212.  Heap restype 'MENU'
  1213.   
  1214.  #-- output
  1215.  
  1216.  BlkAddr    BlkLength Typ MasterPtr  Flags RType   RId RFRef  RName
  1217.  $00316590  $00000098  H  $0031452C    R   MENU   1000 $0584  "File"
  1218.  $00316838  $00000050  H  $00314528    R   MENU   1001 $0584  "Edit"
  1219.  $00316888  $000000F4  H  $00314524    R   MENU   1002 $0584  "Log"
  1220.  
  1221.  Heap Check Description
  1222.      The Heap Check command checks the consistency of the current application 
  1223.  heap, which is by default the heap referenced by the global variable theZone. 
  1224.  You can specify another heap, but addr must be the address of the heap zone 
  1225.  header. (In other words, you can't check part of a heap.)
  1226.      Heap Check performs range checking to make sure all pointers are even and 
  1227.  non-NIL, and that block sizes are within the range of the heap. It verifies 
  1228.  that the self-relative handle points to a master pointer referring to the same 
  1229.  block. For nonrelocatable blocks, it checks if the heap zone pointer points to 
  1230.  the zone where the block exists. Heap Check also verifies that the total amount 
  1231.  of free space is equal to the amount specified in the header, and that all 
  1232.  pointers in the free master pointer list are in the heap. 
  1233.  
  1234.  Examples    
  1235.  
  1236.  Printf "Checking %P's heap at $%.08X\n", ^Pstring( $910)^, TheZone
  1237.  Heap Check TheZone
  1238.   
  1239.  Printf "Checking the System heap at $%.08x\n", SysZone
  1240.  Heap Check SysZone
  1241.   
  1242.  Printf "Checking the Multifinder heap at $%.8x\n", **$2a6+$c
  1243.  Heap Check $2a6^^+$c
  1244.   
  1245.  #-- output
  1246.   
  1247.  Checking SADE's heap at $00146EF2
  1248.    The heap is okay.
  1249.  Checking the System heap at $00001400
  1250.    The heap is okay.
  1251.  Checking the Multifinder heap at $00023d64
  1252.    The heap is okay.
  1253.  
  1254.  Heap Totals Description
  1255.      The Heap Totals command summarizes the state of the current application 
  1256.  heap, which is by default the heap referenced by the global variable theZone. 
  1257.  You can specify another heap that starts at addr.
  1258.      Information is given for free, nonrelocatable, and relocatable objects. If
  1259.  you wish to restrict the display to a particular type of block, you can specify 
  1260.  one of the  following blocktypes:
  1261.  •    purge[able] limits the display to purgeable blocks.
  1262.  •    nonreloc[atable] limits the display to nonrelocatable blocks. 
  1263.  •    reloc[atable] limits the display to relocatable blocks.
  1264.  •    free limits the display to free blocks.
  1265.  •    lock[ed] limits the display to locked  blocks. 
  1266.  •    res[ource] limits the display to resources.
  1267.  •    restype type limits the display to the specified resource type.
  1268.      Note that type is case-sensitive and should be enclosed in single
  1269.  quotation marks ('CODE', for example).
  1270.  
  1271.  Example
  1272.  
  1273.  heap totals
  1274.  
  1275.  #-- output
  1276.                           Total Blks  Total Size
  1277.  Free                             23       49080
  1278.  Nonrelocatable                    7        1348
  1279.  Relocatable                      89       21232
  1280.    Locked & NonPurgeable           2        5796
  1281.    Locked & Purgeable              2        8136
  1282.    UnLocked & Purgeable            6         680
  1283.    UnLocked & NonPurgeable        79        6620
  1284.  Heap (total)                    119       71660
  1285. -
  1286. Help -display help information
  1287.  Syntax    
  1288.      help [ identifier ,... ]
  1289.     help Expr(expression)
  1290.  
  1291.  Description
  1292.      The Help command displays information about using SADE, including the 
  1293.  syntax of all SADE commands. To see what values identifier can have, just 
  1294.  enter help.  The first form takes unquoted tokens which represent names of
  1295.  command, functions, variables, etc.  The second form takes an expression
  1296.  which will be evaluated to yield the name about which to get help information.
  1297. -
  1298. If ...End -conditional execution of commands
  1299.  Syntax    
  1300.     if  Boolean  [ then ]
  1301.         commands
  1302.     [ elseif Boolean   [ then ]
  1303.         commands ] ...
  1304.     [ else
  1305.         commands ]
  1306.     end
  1307.  
  1308.  Description
  1309.      The If...End construct allows for conditional execution of sequences of 
  1310.  SADE commands. Each if must be concluded by a corresponding end. Elseif and 
  1311.  else are optional, but must appear between the if and end in the order indicated 
  1312.  above. More than one elseif may appear, but at most one else may appear.
  1313.      The commands controlled by an if extend to the corresponding end, or to the 
  1314.  first corresponding elseif or else. The commands controlled by an elseif extend 
  1315.  to the next corresponding elseif, else, or end.  The commands controlled by an 
  1316.  else extend to the corresponding end.
  1317.      When an If...End construct is evaluated, if the if Boolean is true, the
  1318.  statements controlled by the if are executed and the remainder of the construct 
  1319.  to the end is skipped. If the Boolean is false, the statements controlled by 
  1320.  the if are skipped and the next (elseif) condition is checked, if present. 
  1321.  If an elseif condition is evaluated and is true, the commands it controls are 
  1322.  executed and the remainder of the construct is skipped. If no conditions are 
  1323.  evaluated as true, when the else command is reached (if present), the commands
  1324.  controlled by the else are executed (otherwise, they're skipped).
  1325.      If...End constructs may be nested.
  1326.  
  1327. Example
  1328.  
  1329.  #-- Steps through a five element array using a low to high index,
  1330.  #-- looking for first true element, and resetting it to false.
  1331.  #-- Done 5 times, starting with the first four elements true
  1332.  #-- and the last element false.
  1333.   
  1334.  define global test[5] := (4 of 1,0)
  1335.   
  1336.  proc IfDemo
  1337.    define whichtest
  1338.    define showMe
  1339.    for whichtest := 1 TO 5 do
  1340.      printf "\n"
  1341.      for showMe := 1 to 5 do
  1342.        printf "%t", test[showMe]
  1343.      end
  1344.      printf " - "
  1345.      if test[1]
  1346.        "test[1] true"
  1347.      elseif test[2]
  1348.       "test[2] true"
  1349.      elseif test[3]
  1350.       "test[3] true"
  1351.      elseif test[4]
  1352.       "test[4] true"
  1353.      elseif test[5]
  1354.       "test[5] true"
  1355.      else
  1356.       "all tests false"
  1357.      end
  1358.      test[whichtest] := 0
  1359.    end
  1360.  end
  1361.   
  1362.  IfDemo
  1363.   
  1364.  #-- output
  1365.   
  1366.  11110 - test[1] true
  1367.   
  1368.  01110 - test[2] true
  1369.   
  1370.  00110 - test[3] true
  1371.   
  1372.  00010 - test[4] true
  1373.   
  1374.  00000 - all tests false
  1375. -
  1376. Kill -kill an application
  1377.  Syntax    
  1378.      kill  filename 
  1379.  
  1380.  Description
  1381.      If you want to terminate an application, (whether it's suspended or not),
  1382.  use the Kill command. Be aware, though, that Kill is dangerous, since it 
  1383.  doesn't give the unlucky application a chance to perform its usual exit 
  1384.  routines (like saving data). Kill does perform cleanup activities like 
  1385.  freeing the MultiFinder memory occupied by the application and removing its 
  1386.  trap patches.  Filename is a string expression and must be enclosed in quotation
  1387.  marks if it's a string constant.
  1388.  
  1389.  Examples
  1390.  
  1391.  kill 'VolName:full:path:to:targetProg'
  1392.  
  1393.  define RootPath := "VolName:full:"
  1394.  kill Concat(RootPath, "path:to:targetProg")
  1395.   
  1396.  directory 'VolName:full:path:to:'
  1397.  kill "targetProg"
  1398. -
  1399. Launch -launch an application
  1400.  Syntax    
  1401.      launch  [filename]
  1402.  
  1403.  Description
  1404.      The Launch command launches the specified application. Filename is a 
  1405.  string expression and must be enclosed in quotation marks if it's a string 
  1406.  constant. Launch does nothing if the file type of the specified file  is not 
  1407.  'APPL'.  If no filename is specified, the current target is launched.  Launching
  1408.  an application that is already executing is the same as executing the go command.
  1409.  
  1410.  Examples    
  1411.  
  1412.  #-- define directory location for target program sources
  1413.  #-- (if not in the same directory as the program file)
  1414.   
  1415.  sourcepath 'VolName:path:targetProg:sources:'
  1416.   
  1417.  #-- define directory location of target program executable file
  1418.  #-- and, if different, the location of its .sym file
  1419.   
  1420.  target 'VolName:path:targetProg' using 'VolName:path:targetProg.sym'
  1421.   
  1422.  #--- then launch the target progam, as in the examples below,
  1423.  #--- SADEKey to suspend and begin debugging it.
  1424.   
  1425.  launch 'VolName:path:targetProg'
  1426.  
  1427.  #-- or
  1428.  
  1429.  define RootPath := "VolName:"
  1430.  launch Concat(RootPath, "path:targetProg")
  1431.  
  1432.  #-- or
  1433.  
  1434.  directory 'VolName:path:'
  1435.  launch "targetProg"
  1436.  
  1437.  see also    Target
  1438. -
  1439. Leave -exit from a looping construct
  1440.  Syntax    
  1441.      leave  [ if  Boolean ]
  1442.  
  1443.  Description
  1444.      The Leave command lets you exit from a Loop, While, Repeat, or For 
  1445.  construct. You can specify a condition for leaving with the if keyword.
  1446.  
  1447.  Example
  1448.   
  1449.  define testnum := 0
  1450.  repeat
  1451.    Printf "testNum = %d\n", testNum
  1452.    leave if testNum = 3
  1453.    testNum := testNum + 1
  1454.  until testNum = 6
  1455.  Printf "after leaving Repeat loop - testNum = %d\n", testNum
  1456.   
  1457.  #-- output
  1458.  
  1459.  testNum = 0
  1460.  testNum = 1
  1461.  testNum = 2
  1462.  testNum = 3
  1463.  after leaving Repeat loop - testNum = 3
  1464.  
  1465.  See also    Cycle, For, Loop, Repeat, While
  1466. -
  1467. Length (str)    
  1468.     Returns the length of its string argument.
  1469. -
  1470. List -list processes, tracepoints, and breakpoints
  1471.  Syntax    
  1472.      list process
  1473.          or
  1474.     list trace [ traps | addrs ]
  1475.         or
  1476.     list break [ traps | addrs ]
  1477.  
  1478.  Description
  1479.      The List command lets you see what processes, breakpoints, and tracepoints
  1480.  are around. 
  1481.      For processes, the display includes the following information: a process 
  1482.  number, a "loaded" or "not-loaded" designation, and the filename and symbol 
  1483.  filename (typically the filename followed by .SYM) for the process.
  1484.      For breakpoints and tracepoints, List displays the location along with
  1485.  its symbolic representation. The optional traps or addrs keywords limit the 
  1486.  display to trap or address breakpoints (or tracepoints) respectively.
  1487.  
  1488.  Examples
  1489.  
  1490.  list break         # list all breakpoints set
  1491.  
  1492.  #-- output
  1493.  
  1494.    EVENTLOOP.(5)    # $21A4E2  # processID =10  # has break action
  1495.    EVENTLOOP.(11)   # $21A500  # processID =10
  1496.    EVENTLOOP.(2)    # $21A4C4  # processID =10
  1497.  
  1498.  list process
  1499.  
  1500.  #-- output
  1501.  
  1502.     Process#  Loaded?     FileName, SymbolFile
  1503.            6  Loaded      SADE,  SADE.SYM
  1504.            2  Loaded      Finder, Finder.SYM
  1505.  
  1506.  See also    Trace, Break
  1507. -
  1508. Loop ...End -repeat commands until Leave
  1509.  Syntax
  1510.      loop
  1511.          commands
  1512.      end
  1513.  
  1514.  Description
  1515.      The Loop...End construct provides unconditional looping. The enclosed 
  1516.  commands are executed repeatedly. To exit the loop, use the Leave command.
  1517.      Loop constructs may be nested.
  1518.  
  1519.  Example
  1520.  
  1521.  define Inner := 0
  1522.  define Outer := 0
  1523.  loop
  1524.    loop
  1525.      Inner := Inner + 1
  1526.      printf "Inner: %d " , Inner
  1527.      leave if Inner > Outer
  1528.    end
  1529.    Inner := 0
  1530.    Outer := Outer + 1
  1531.    printf "Outer: %d\n", Outer
  1532.    leave if Outer > 4
  1533.  end
  1534.   
  1535.  #-- output
  1536.  
  1537.  Inner: 1 Outer: 1
  1538.  Inner: 1 Inner: 2 Outer: 2
  1539.  Inner: 1 Inner: 2 Inner: 3 Outer: 3
  1540.  Inner: 1 Inner: 2 Inner: 3 Inner: 4 Outer: 4
  1541.  Inner: 1 Inner: 2 Inner: 3 Inner: 4 Inner: 5 Outer: 5
  1542.  
  1543.  See also    Leave
  1544. -
  1545. Macro -define a macro
  1546.  Syntax    
  1547.      macro name  string-expr
  1548.  
  1549.  Description    
  1550.      The Macro command associates a string of characters with a name.  Macros 
  1551.  let you define short, familiar names to use instead of long, unfamiliar 
  1552.  strings. For instance, the SADEStartup file defines macros that let you use 
  1553.  MacsBug-like syntax for certain SADE commands. 
  1554.      Macro definitions can be nested; that is, they can contain references
  1555.  to other macros. Macro definitions cannot be recursive, however; in other 
  1556.  words, a macro definition can't reference itself. Macro definitions are not 
  1557.  allowed in structured statements. Macros may be redefined.  Macro definitions 
  1558.  are limited to a length of 254 characters. 
  1559.  
  1560.  Examples
  1561.  
  1562.  macro br 'break'
  1563.  macro clr  'unbreak all'
  1564.  
  1565.  macro dir "volume:very:long:directory:path"
  1566.  directory dir
  1567. -
  1568. NaN (n)    
  1569.     Returns the NaN (Not a Number) with the specified value.
  1570. -
  1571. OnEntry -set commands for SADE entry
  1572.  Syntax    
  1573.      onEntry [ break-action ] 
  1574.  
  1575.  Description
  1576.      The OnEntry command supplies commands that are to be executed each time 
  1577.  SADE is entered. Each OnEntry command replaces the commands specified by the 
  1578.  previous OnEntry command. In the SADEStartup file, the StandardEntry procedure 
  1579.  is specified as an OnEntry break action. You can define your own OnEntry 
  1580.  actions in the SADEUserStartup file, but you'll probably want to use the one in
  1581.  SADEStartup as a model (so as not to lose the operations it performs). 
  1582.      The OnEntry command accepts only one command or procedure invocation. If you 
  1583.  want to execute multiple commands and/or procedures upon entry, use the 
  1584.  Begin..End construct to group them.
  1585.  
  1586.  See also    Break, Begin
  1587. -
  1588. Open -open a file
  1589.  Syntax    
  1590.      open [ source ]  [ behind ]  filename 
  1591.  
  1592.  Description
  1593.      The Open command opens the specified file. Filename is a string expression 
  1594.  and must be enclosed in quotation marks if it's a string constant. The file 
  1595.  must be of type 'TEXT'. The source keyword opens the window read-only. If you 
  1596.  specify behind, the window is opened just behind the frontmost SADE window, 
  1597.  otherwise, it's opened as the frontmost window.
  1598.  
  1599.  Example
  1600.  
  1601.  open 'myFile'
  1602.  
  1603.  See also    Close, Save
  1604. -
  1605. Printf -print formatted output
  1606.  Syntax    
  1607.      printf  [ format [ , argument ] ... ]
  1608.          or
  1609.      printf  [ (format [ , argument ] ... ) ]
  1610.  
  1611.  Description
  1612.      The Printf command is the most complicated of the SADE commands.  If you 
  1613.  find its myriad options intimidating, remember that Printf has one simple and 
  1614.  important use:  printing anything you want to a SADE window or file. You can 
  1615.  also use Printf to convert and format values in just about any way you might want.
  1616.  Format is a string containing characters to print, as well as format specifications
  1617.  for arguments that follow. Format specifications are preceded by the % character.
  1618.  For instance, to print the value of the variable myVar as a decimal number, 
  1619.  along with a message, enter: printf "The value of myVar is %d" myVar
  1620.  Each format specification applies to zero or more arguments. When the format 
  1621.  specifications are exhausted, any remaining arguments are ignored. Likewise, 
  1622.  when the specified arguments are exhausted, any remaining format specifications 
  1623.  are ignored.
  1624.  
  1625. Examples
  1626.   
  1627.  #-- Displays record definition of system type EventRecord.
  1628.  #-- Notice how EventRecord.Where, which is of type Point, has been
  1629.  #-- expanded to show its definition too.
  1630.   
  1631.  printf "%P", ^pstring($910)^
  1632.  myProg
  1633.   
  1634.  printf "%P", *(pstring*) $910
  1635.  myProg
  1636.   
  1637.  printf "%-t", EventRecord
  1638.  RECORD
  1639.    WHAT: Word;
  1640.    MESSAGE: Long;
  1641.    WHEN: Long;
  1642.    WHERE: RECORD
  1643.             CASE Word OF
  1644.               (1):
  1645.                 (RECORD
  1646.                    V: Word;
  1647.                    H: Word;
  1648.                  END);
  1649.   
  1650.               (2):
  1651.                 (RECORD
  1652.                    VH: ARRAY [(0, 1)] OF
  1653.                          Word;
  1654.                  END);
  1655.           END;
  1656.    MODIFIERS: Word;
  1657.  END
  1658.   
  1659.  
  1660.  #-- Doing the same thing with a target program variable
  1661.  #-- of type EventRecord. The %t format specifier lets
  1662.  #-- the Printf display format be controlled by the
  1663.  #-- type of the variable displayed.
  1664.   
  1665.  typeof(myEvent)
  1666.     EVENTRECORD
  1667.   
  1668.  printf "%t", myEvent
  1669.  RECORD
  1670.    WHAT: 3;
  1671.    MESSAGE: 16686;
  1672.    WHEN: 284053;
  1673.    WHERE: RECORD
  1674.             CASE Word OF
  1675.               (1):
  1676.                 (RECORD
  1677.                    V: 272;
  1678.                    H: 267;
  1679.                  END)
  1680.               (- - -);
  1681.           END;
  1682.    MODIFIERS: 2432;
  1683.  END
  1684. -
  1685. Proc ...End -define a SADE procedure
  1686.  Syntax    
  1687.      proc  name [ arg-name ,... ]
  1688.          commands
  1689.      end
  1690.          or
  1691.      proc  name  [ ( arg-name ,... ) ]
  1692.          commands
  1693.      end
  1694.  
  1695.  Description
  1696.      SADE procedures are delimited by the Proc...End construct. The procedure 
  1697.  name is followed by an optional parameter list; if present, the list identifies 
  1698.  parameters by name only. Parameters are not assigned a type but instead take on
  1699.  the types of the actual parameter values when the procedure is called.
  1700.      The parameter list may optionally be enclosed in parentheses. If the
  1701.  parentheses are included in the definition, they must also be used when the 
  1702.  procedure is called (and vice versa).
  1703.      The number of actual parameters need not match the number of formal 
  1704.  parameters in the definition. If too few actual parameters are specified, the 
  1705.  formal parameters for which there were no corresponding actual parameters are 
  1706.  assigned a special undefined value. Extra actual parameters have no corresponding
  1707.  formal name but can be referenced through the predefined SADE variable Arg, which
  1708.  lets you access the parameters of a procedure with references of the form arg[n]. 
  1709.  The number of the last actual parameter specified is contained in the predefined
  1710.  SADE variable NArgs. Note that the values of these variables represent the 
  1711.  parameter state of the currently active procedure and are not defined outside it.
  1712.      Procedures may be redefined. A procedure must be defined before a call to it
  1713.  can be processed. If you want mutually recursive procedures, a "dummy" procedure
  1714.  (similar to a Pascal FORWARD definition) must first be defined. A second 
  1715.  procedure can then redefine the first one, referencing the second procedure. 
  1716.  The minimal dummy procedure definition is:  proc foo; end.
  1717.      Procedure calls may be nested.
  1718.  
  1719. Example
  1720.  
  1721.  #-- This procedure illustrates the use of the
  1722.  #-- Arg(n) and Nargs built-in SADE variables
  1723.   
  1724.  proc myProc (arg1, arg2, arg3, arg4)
  1725.  define looper
  1726.   
  1727.    "in myproc"
  1728.    printf( "called with nargs: %d \n", nargs)
  1729.    for looper := 1 to nargs
  1730.      printf ("arg %d: %d \n", looper, arg[looper])
  1731.    end
  1732.    "\n"
  1733.  end
  1734.   
  1735.  "call myproc with 1 arg"
  1736.  myproc(1)
  1737.  "call myproc with 2 args"
  1738.  myproc(1,2)
  1739.  "call myproc with 3 args"
  1740.  myproc(1,2,3)
  1741.  "call myproc with 4 args"
  1742.  myproc(1,2,3,4)
  1743.   
  1744.  #-- output
  1745.   
  1746.  call myproc with 1 arg
  1747.  in myproc
  1748.  called with nargs: 1
  1749.  arg 1: 1
  1750.   
  1751.  call myproc with 2 args
  1752.  in myproc
  1753.  called with nargs: 2
  1754.  arg 1: 1
  1755.  arg 2: 2
  1756.   
  1757.  call myproc with 3 args
  1758.  in myproc
  1759.  called with nargs: 3
  1760.  arg 1: 1
  1761.  arg 2: 2
  1762.  arg 3: 3
  1763.   
  1764.  call myproc with 4 args
  1765.  in myproc
  1766.  called with nargs: 4
  1767.  arg 1: 1
  1768.  arg 2: 2
  1769.  arg 3: 3
  1770.  arg 4: 4
  1771.  
  1772.  See also    Func
  1773. -
  1774. Quit -quit SADE
  1775.  Syntax
  1776.      quit
  1777.  
  1778.  Description
  1779.      The Quit command terminates SADE and passes control to another process
  1780.  as determined by MultiFinder. Be aware that Quit kills any suspended 
  1781.  applications. 
  1782.  
  1783.  See also    Shutdown
  1784. -
  1785. Redirect -redirect output
  1786.  Syntax
  1787.      redirect  [ append ]  filename
  1788.          or
  1789.      redirect  [ pop ] [ all ]
  1790.  
  1791.  Description
  1792.      The Redirect command redirects the output from SADE commands to the 
  1793.  specified file. The simplest way to use redirection is to replace the 
  1794.  contents of the named file. If you specify the append keyword, the output
  1795.  is appended to the end of the file. You can also use the S character (Option-6)
  1796.  to replace or append to the selection in an open window (see the example below).
  1797.      Warning:  Be aware that if you use use Redirect to replace the contents of
  1798.  a file that's not open, there's no way to undo it. (If the file is open, you 
  1799.  can close it and respond "No" when the dialog asks whether to save changes.)
  1800.      You can nest Redirect commands to as many as 10 different files; SADE 
  1801.  maintains the names of these files as a last-in, first-out queue. If you use 
  1802.  the pop keyword, or if you use no parameters at all, the output from SADE 
  1803.  commands is redirected to the file at the head of the queue. If all or pop 
  1804.  all is specified, standard output is redirected to the current command window.
  1805.      Note:  Any error conditions cause SADE to perform an implicit pop all for 
  1806.  any redirected files; this ensures that output returns to the current command 
  1807.  window.
  1808.  
  1809. Examples
  1810.  
  1811.  redirect "whyNot.S"   # Replace the current selection
  1812.    
  1813.  #-- In the next example, the Redirect command creates a file to hold
  1814.  #-- output from SADE. Entering a string echos the string.
  1815.  #-- That output is redirected to the file, becoming
  1816.  #-- the file's contents.
  1817.  #-- Here the string is a comment and a SADE command to execute
  1818.  #-- the contents of the next file in the chain.
  1819.   
  1820.  open 'exec1'
  1821.  redirect 'exec1'
  1822.   
  1823.    '"\n executing exec1 now"'
  1824.    "execute 'exec2'"
  1825.  
  1826.    open "exec2"
  1827.    redirect 'exec2'
  1828.      "'now executing exec2'"
  1829.      "execute 'exec3'"
  1830.  
  1831.      open "exec3"
  1832.      redirect 'exec3'
  1833.        '"Done in exec3"'
  1834.  
  1835.  redirect pop all
  1836.  execute "exec1"
  1837.   
  1838.  Alert "Try a tile windows here\n_
  1839.     Then look at the worksheet for output"
  1840.   
  1841.  #-- output
  1842.   
  1843.  executing exec1 now
  1844.  now executing exec2
  1845.  Done in exec3
  1846. -
  1847. Repeat ...Until -conditionally repeat commands 
  1848.  Syntax    
  1849.      repeat
  1850.          commands
  1851.      until Boolean
  1852.  
  1853.  Description
  1854.      The Repeat ... Until construct provides conditional looping with a test
  1855.  at the end of the loop. The enclosed commands are executed until Boolean is
  1856.  true. The enclosed commands are executed at least once.
  1857.      Repeat constructs may be nested.
  1858.  
  1859.  Example
  1860.  
  1861.  target 'MyProg'
  1862.  break \MyProg.MainEventLoop.(1)
  1863.  launch 'MyProg'
  1864.  #-- hasEvent is a global variable in MyProg initialized to 0
  1865.  printf "Pc at %t \nEventReceived? %t \n", where (pc), hasEvent
  1866.   
  1867.  define dummy
  1868.  repeat
  1869.    step
  1870.    dummy := addrtosource(pc, 1)
  1871.  until hasEvent
  1872.   
  1873.  printf "\nPc at %t \nEventReceived? %t \n", where (pc), hasEvent
  1874.  
  1875.  #-- output 
  1876.   
  1877.  Pc at MAINEVENTLOOP.(1)
  1878.  EventReceived? FALSE
  1879.   
  1880.  Pc at MAINEVENTLOOP.(32)
  1881.  EventReceived? TRUE
  1882.  
  1883.  See also    Leave
  1884. -
  1885. Request (msg [,default])    
  1886.     Displays a request dialog box with the specified message (with an optional
  1887.  default response) and returns the user response.  If the user cancels,
  1888.  Request will return the string '_CANCEL_'.
  1889. -
  1890. Resource -display the resource map
  1891.  Syntax    
  1892.      resource [ display ] [ addr ] [ restype 'type ' ]
  1893.     resource check [ addr ]
  1894.  Resource Display Description
  1895.      The Resource command displays the contents of your application's resource
  1896.  maps and the system resource map. If you want to display only a particular map,
  1897.  addr should be the address of the map. The information displayed for each map
  1898.  includes:  its location, the resource ID, the resource type, the value of the
  1899.  master pointer, whether the resource is locked or unlocked, and the resource 
  1900.  name. If a resource isn't loaded, the master pointer field says "not loaded."
  1901.      You can also restrict the display to a particular resource type by using
  1902.  the restype keyword with the desired type. Note that type is case-sensitive 
  1903.  and should be enclosed in single quotation marks ('WIND', for example).
  1904.  
  1905.  Example
  1906.  
  1907.  resource restype 'WIND'
  1908.  
  1909.  #-- output
  1910.  
  1911.  Resource Map at $00316EF8
  1912.     ResId  RType  MasterPtr  Locked?   Name
  1913.      1000  WIND   $00316BE4  Unlocked  
  1914.      1001  WIND   $00316C08  Unlocked  
  1915.      1002  WIND   $00316484  Unlocked  
  1916.      1003  WIND   $003164B8  Unlocked  
  1917.      1004  WIND   $003164D8  Unlocked  
  1918.  Resource Map at $0002B19C
  1919.     ResId  RType  MasterPtr  Locked?   Name
  1920.    -16000  WIND   NotLoaded            
  1921.    -15968  WIND   NotLoaded            
  1922.    -15840  WIND   NotLoaded            
  1923.  
  1924. Resource Check Description
  1925.     The Resource Check command checks the target application's resource 
  1926.  maps for consistency. If you want to check a particular map, addr should 
  1927.  point to the address of the map. If an inconsistency is found, the command
  1928.  displays a diagnostic message specifying the problem.
  1929. -
  1930. Return -return from a procedure or function
  1931.  Syntax
  1932.      return [ result ]
  1933.  
  1934.  Description
  1935.      The Return command returns you from a procedure or function currently
  1936.  in execution. When returning from a function, the function result must be 
  1937.  specified. (When returning from a procedure, there is no return value.)
  1938.  
  1939.  Example    
  1940.  
  1941.  func MiscTypes (index)
  1942.    define global SadeArray[4] := (1, "this is two", 3.3, 4)
  1943.    return SadeArray[index]
  1944.  end
  1945.   
  1946.  define selector
  1947.  for selector := 1 to 4 do
  1948.    printf "%t \n", MiscTypes(selector)
  1949.  end
  1950.  
  1951.  #-- output
  1952.   
  1953.  1
  1954.  this is two
  1955.  3.3
  1956.  4
  1957.  
  1958.  See also    Func, Proc
  1959. -
  1960. SADEKey -define a key for entering SADE
  1961.  Syntax    
  1962.      sadekey [ keycode ]
  1963.  
  1964.  Description
  1965.      The SADEKey command lets you specify a different Command-Option key
  1966.  combination for entering SADE. A complete list of keycodes can be found in
  1967.  the Toolbox Event Manager chapter of Inside Macintosh Volume V. To see what
  1968.  key is specified as the SADEKey, just type sadekey.
  1969.  
  1970.  Example    
  1971.  
  1972.  sadekey 33    #-- define Command-Option-Delete combination as SADEKey
  1973. -
  1974. Save -save a file
  1975.  Syntax    
  1976.      save [ all | filename ]
  1977.  
  1978.  Description
  1979.      The Save command saves the specified file or, if all is specified, saves 
  1980.  all files. Filename is a string expression and must be enclosed in quotation 
  1981.  marks if it's a string constant. If the specified file wasn't modified since
  1982.  the last time it was saved, Save does nothing.
  1983.      If no parameters are given, Save saves the target window.
  1984.  
  1985.  Example
  1986.  
  1987.  save 'myFile'
  1988.  
  1989.  See also    Open, Close
  1990. -
  1991. Selection (windowname [,n [,m]])
  1992.     Returns the text of the selection in the specified window as a string.  At
  1993.  most 254 characters will be returned.  If the optional second and third
  1994.  integer arguments are specified, the selection will first be set to the
  1995.  specified character offsets in the file.  (The character indices are zero
  1996.  based.)
  1997. -
  1998. Shutdown -shut down or restart the machine
  1999.  Syntax    
  2000.      shutdown [ restart ]
  2001.  
  2002.  Description
  2003.      The Shutdown command terminates SADE and calls the Shutdown Manager. 
  2004.  If restart is specified, the Macintosh is restarted. Be aware that all 
  2005.  unsaved work is lost.
  2006. -
  2007. SizeOf (expr)    
  2008.     Returns the size of object specified by its expression argument.
  2009. -
  2010. SizeWindow -change the size of a window
  2011.  Syntax
  2012.      SizeWindow [To h,v] [windowname]
  2013.  
  2014.  Description
  2015.      The SizeWindow command sets or displays the size of the specified window.
  2016.  The argument windowname is a string expression.  If it isn't specified, 
  2017.  TargetWindow is assumed.  If the To keyword is used, the window is resized
  2018.  to the specified horizontal and vertical dimensions.  Otherwise the size
  2019.  of the specified window is written out.
  2020. -
  2021. SourcePath -tell SADE where your source files are
  2022.  Syntax
  2023.      sourcepath [ [ add | del[ete] ] directoryname , ... ]
  2024.  
  2025.  Description
  2026.      The SourcePath command tells SADE what directory your source files are 
  2027.  in. If your source files are in more than one directory, you can give the 
  2028.  SourcePath command a list. If you're unsure which directories you've specified,
  2029.  simply enter sourcepath and the current search path is displayed.
  2030.      If you want to add a directory to, or delete a directory from, the
  2031.  previously specified directories in the search path, you can use the add or 
  2032.  delete keywords. Note that if you specify a directory without using the add 
  2033.  keyword, any directories previously specified are replaced.    
  2034.  
  2035.  Examples
  2036.  
  2037.  sourcepath 'srcdir', ':myotherdir' # sources in more than one directory
  2038.  
  2039.  sourcepath add ":samples"          # add directory Samples to search path
  2040.  
  2041.  See also    Directory
  2042. -
  2043. SourceToAddr (string-expr [,bool])    
  2044.     Returns the code address which corresponds to the location of the beginning of
  2045.  the selection in the window (file) specified by the string expression argument.
  2046.  A value of zero is returned if SADE was not able to determine what address the
  2047.  window selection represents.  If the optional second argument is specified and
  2048.  is non-zero, the function will return a PString with an error message if it
  2049.  fails to determine the address.
  2050. -
  2051. Stack -display stack frames
  2052.  Syntax    
  2053.      stack  [ count ] [ at addr ]
  2054.  
  2055.  Description
  2056.      The Stack command displays a list of the stack frames for the target 
  2057.  application. The stack frames displayed are based on register A6 or addr if 
  2058.  at is specified. 
  2059.      For each entry, Stack gives the address of the stack frame, the name of
  2060.  the procedure or function that allocated the frame, and the name and offset 
  2061.  (if available) of the parent procedure.
  2062.      If an explicit count is specified, then at most that many stack frames
  2063.  (counting back from the current frame) are displayed.
  2064.  
  2065.  Example
  2066.  
  2067.  stack at DisplayText.(6)
  2068.  stack
  2069.   Frame Addr  Frame Owner   Called From
  2070.    <main>      CMain
  2071.    $0032BC24   main          CMain+$0028
  2072.    $0032BB2C   SkelMain      main.(51)
  2073.    $0032BB0C   LogEvent      SkelMain.(13)+$0012
  2074.    $0032BADC   ReportUpdate  LogEvent.(50)+$0004
  2075.    $0032BACC   DisplayText   ReportUpdate.(1)+$0004
  2076. -
  2077. Step -single step execution
  2078.  Syntax    
  2079.      step [ asm | line ] [ into ]
  2080.  
  2081.  Description
  2082.      The Step command lets you execute your program one step at a time, 
  2083.  from either the source code level or the object code level. If line (the 
  2084.  default) is specified, execution proceeds one source statement at a time. 
  2085.  If the source window containing the current line can be found, the next line 
  2086.  to be executed is indicated.
  2087.      If asm is specified, execution proceeds one instruction at a time; the
  2088.  instruction at the program counter is executed and SADE is re-entered.  Traps 
  2089.  are always treated as single instructions; SADE steps over them, stopping at
  2090.  the first instruction following the trap. Subroutines called by JSR and BSR
  2091.  instructions can either be stepped over or stepped into. If into is specified,
  2092.  SADE steps in, stopping at the first instruction of the subroutine. If into
  2093.  is omitted, BSRs and JSRs are treated as single instructions.
  2094.     Warning:  Don't try to step over a routine that does not return to the
  2095.  caller; for instance, a call to longjmp(). SADE steps over procedure and 
  2096.  function calls by setting the trace bit until after the JSR or BSR is executed, 
  2097.  and then replaces the return address with the address of a SADE routine. Since
  2098.  longjmp() restores a previously saved register set, including a new stack 
  2099.  pointer, SADE's return is lost. If you want to go to the routine restored by
  2100.  longjump0, execute step asm into until the registers have been modified and
  2101.  then do a source step. Or better still, if you know where the jump will go, 
  2102.  set a breakpoint in that routine.
  2103.  
  2104.  Example    
  2105.  
  2106.  proc stepProc
  2107.    "\ncurrent pc"
  2108.    disasm pc 4
  2109.   
  2110.    "\nstep by instruction twice"
  2111.    step asm
  2112.    disasm pc 1
  2113.    step asm
  2114.    disasm pc 1
  2115.   
  2116.    "\nstep into a procedure call"
  2117.    step into
  2118.    disasm pc 4
  2119.   
  2120.    "\nstep by statement line twice"
  2121.    step line
  2122.    disasm pc 4
  2123.    step
  2124.    disasm pc 4
  2125.   
  2126.    stop
  2127.  end
  2128.   
  2129.  kill 'events'
  2130.   
  2131.  target 'myProg'
  2132.  break \myProg.MAINEVENTLOOP.(11) stepProc
  2133.  launch 'myProg'
  2134.  go
  2135.   
  2136.  #-- output
  2137.   
  2138.  current pc
  2139.  MAINEVENTLOOP
  2140.     +004C  0011F706  486D FFBE       **PEA        -$0042(A5)
  2141.     +0050  0011F70A  2F0E              MOVE.L     A6,-(A7)
  2142.     +0052  0011F70C  4EBA FE94         JSR        CALLEDPROC    ; 0011F5A2
  2143.     +0056  0011F710  42A7              CLR.L      -(A7)
  2144.   
  2145.  step by instruction twice
  2146.  MAINEVENTLOOP
  2147.     +0050  0011F70A  2F0E             *MOVE.L     A6,-(A7)
  2148.  MAINEVENTLOOP
  2149.     +0052  0011F70C  4EBA FE94        *JSR        CALLEDPROC    ; 0011F5A2
  2150.   
  2151.  step into a procedure call
  2152.  CALLEDPROC
  2153.     +0000  0011F5A2  4E56 FFFC        *LINK       A6,#$FFFC
  2154.     +0004  0011F5A6  2F2D FFE0         MOVE.L     -$0020(A5),-(A7)
  2155.     +0008  0011F5AA  A873              _SetPort                       ; A873
  2156.     +000A  0011F5AC  42A7              CLR.L      -(A7)
  2157.   
  2158.  step by statement line twice
  2159.  CALLEDPROC
  2160.     +0004  0011F5A6  2F2D FFE0        *MOVE.L     -$0020(A5),-(A7)
  2161.     +0008  0011F5AA  A873              _SetPort                       ; A873
  2162.     +000A  0011F5AC  42A7              CLR.L      -(A7)
  2163.     +000C  0011F5AE  A975              _TickCount                     ; A975
  2164.  CALLEDPROC
  2165.     +000A  0011F5AC  42A7             *CLR.L      -(A7)
  2166.     +000C  0011F5AE  A975              _TickCount                     ; A975
  2167.     +000E  0011F5B0  2D5F FFFC         MOVE.L     (A7)+,-$0004(A6)
  2168.     +0012  0011F5B4  42A7              CLR.L      -(A7)
  2169. -
  2170. Stop -terminate break action
  2171.  Syntax
  2172.      stop
  2173.  
  2174.  Description
  2175.      The Stop command terminates the current break action and returns you to 
  2176.  SADE. If the current execution was within a structured statement (Begin...End, 
  2177.  for instance), or if multiple commands were selected, the pending commands are 
  2178.  executed. To terminate a break action and cancel pending commands, see the 
  2179.  Abort command.
  2180.  
  2181.  Example    
  2182.  
  2183.  directory  'VolName:Path:toMyProg:'
  2184.  launch 'myProg'
  2185.   
  2186.  proc WhichEvent(stopType)
  2187.    define global EventType[16] := ('null',
  2188.    'mouse-down','mouse-up',
  2189.    'key-down', 'key-up','auto-key',
  2190.    'update', 'disk-inserted','activate',
  2191.    'network', 'device driver', 'app1',' app2', 'app3', 'app4')
  2192.   
  2193.    if theEvent.what  = stopType then
  2194.      printf "%P received, stopping\n", EventType[stopType+1]
  2195.      stop
  2196.    else
  2197.      EventType[theEvent.what+1]
  2198.      printf
  2199.    end
  2200.  end
  2201.   
  2202.  break _waitNextEvent from applzone..applzone^ whichEvent(1)
  2203.  go
  2204.  
  2205.  #-- output
  2206.   
  2207.  key-down
  2208.  update
  2209.  key-down
  2210.  mouse-down received, stopping
  2211.  
  2212.  See also    Abort, Break, Quit
  2213. -
  2214. Target -tell SADE about your application
  2215.  Syntax    
  2216.      target [ progname [ using symbolfilename ] ]
  2217.  
  2218.  Description
  2219.      The Target command tells SADE the name of the application you want to 
  2220.  debug; and identifies the symbol file (the .SYM file generated by the linker). 
  2221.  If the .SYM file is already in the same directory as the application and is
  2222.  called progname.SYM (which it usually is), you don't need to bother with the 
  2223.  using keyword.  Progname and symbolfilename are string expressions and must be
  2224.  enclosed in quotes if they are string constants.
  2225.      To find out what the current target is, just type target.
  2226.  
  2227.  Example    
  2228.  
  2229.  target "VolName:MPW:MPW Shell" using "VolName:MPW:ToolStuff:tool.sym"
  2230.  sourcePath add "VolName:MPW:ToolStuff:"
  2231.  break \ToolMain.main.(1)
  2232.  launch "mpw shell"
  2233.   
  2234.  #-- Run tool to break to SADE with tool as target
  2235.  #-- and pc at main.(1)
  2236. -
  2237. Timer ([n [,bool]])    
  2238.     If no arguments are specified, Timer returns the curretn TickCount.
  2239.  If one argument is specified, then Timer returns TickCount-n (useful
  2240.  for taking the difference between two times).  If the bool argument
  2241.  is specified and is non-zero then Timer returns a string of the form
  2242.  "sss.hh" representing seconds and hundreths.  If the bool argument is
  2243.  zero then Timer responds as in the one argument case.
  2244. -
  2245. Trace -set tracepoints
  2246.  Syntax    
  2247.      trace addr ,...
  2248.          or
  2249.      trace trap [ from  addr-range ] ,...
  2250.          or
  2251.      trace trap-range [ from  addr-range ] ,...
  2252.          or
  2253.      trace all traps [ from  addr-range ] 
  2254.         or
  2255.     trace class <classname>
  2256.         or
  2257.     trace overload <functionname>
  2258.  
  2259.  Description    
  2260.      The Trace command sets tracepoints on the specified address or traps 
  2261.  within the target program. Tracepoints can be set on a single trap, a range
  2262.  of traps, or on all traps. Traps can be specified by either trap name or 
  2263.  trap number. Trap numbers must be prefixed with the "*" character and trap 
  2264.  names must be preceded by an underscore. 
  2265.      After setting the tracepoints, you can resume program execution. When
  2266.  the tracepoint is encountered, a message is displayed on standard output, 
  2267.  reporting the address or trap being traced, with a symbolic representation 
  2268.  of the address if possible. If addr-range is specified, the message is 
  2269.  displayed only if the trap was called from the specified memory range. In 
  2270.  any case, program execution resumes after the message is displayed.
  2271.      You can specify multiple tracepoints, separated by commas, with a single 
  2272.  Trace command.
  2273.      The class keyword is used to set tracepoints on all routines associated
  2274.  with the specified class.  The overload keyword is used to set tracepoints
  2275.  on all routines of the specified name in all classes.
  2276.      To remove a tracepoint, use the Untrace command.
  2277.  
  2278.  Example
  2279.  
  2280.  trace _OpenResFile.._GetResource    #use a trap range
  2281.  trace *$A997..*$A9A0                #use a trap range
  2282.  
  2283.  See also    Untrace
  2284. -
  2285. TypeOf (expr)    
  2286.     Returns a string with the name (if known) of the type of its expression
  2287.  argument.  If the type name is not known then a string of the form
  2288.  "Type #n" is returned, where n is SADE's internal index for that type.
  2289. -
  2290. Unbreak -remove breakpoints
  2291.  Syntax    
  2292.      unbreak addr ,...
  2293.          or
  2294.      unbreak trap ,...
  2295.          or
  2296.      unbreak trap-range ,...
  2297.          or
  2298.      unbreak all [ traps | addrs ]
  2299.         or
  2300.     unbreak class <classname>
  2301.         or
  2302.     unbreak overload <functionname>
  2303.  
  2304.  Description    
  2305.      The Unbreak command clears the breakpoint, as well as any associated 
  2306.  break action, for the specified addresses or traps. The all keyword clears 
  2307.  all breaks set in the target program. The all keyword can optionally be 
  2308.  followed by traps or addrs to restrict the command to traps or addresses 
  2309.  respectively.
  2310.      The class keyword is used to clear breakpoints on all routines associated
  2311.  with the specified class.  The overload keyword is used to clear breakpoints
  2312.  on all routines of the specified name in all classes.
  2313.  
  2314.  Example
  2315.  
  2316.  unbreak _GetResource    #undo break on GetResource trap
  2317.  
  2318.  See also    Break
  2319. -
  2320. Undef (SADEvar)    
  2321.     Returns 1 if the specified SADE var is uninitialized and 0 otherwise.
  2322. -
  2323. Undefine -remove definitions
  2324.  Syntax    
  2325.      undefine name ,...
  2326.  
  2327.  Description
  2328.      The Undefine command removes the definition; of the specified global 
  2329.  SADE variable, procedure, function, or macro. You can supply a list of names
  2330.  to remove multiple definitions. Note that Undefine does not remove local 
  2331.  variables defined within SADE procedures or functions. 
  2332.      If you want to redefine an item, you don't need to use Undefine; you
  2333.  can just assign a new value to the existing name using the Define command.
  2334.  
  2335.  Example
  2336.  
  2337.  proc ControlledProc
  2338.    printf "%d   ", ControllerGlobal
  2339.  end
  2340.   
  2341.  proc Controller
  2342.    define global ControllerGlobal
  2343.    define max := 7
  2344.   
  2345.    for ControllerGlobal := 1 to max
  2346.      ControlledProc
  2347.    end
  2348.    Undefine ControllerGlobal
  2349.    Undefine ControlledProc
  2350.  end
  2351.  
  2352.  #-- output
  2353.   
  2354.  Controller
  2355.  1   2   3   4   5   6   7
  2356.   
  2357.  ControllerGlobal
  2358.  ### Could not find "ControllerGlobal" as a program symbol
  2359.   
  2360.  ControlledProc
  2361.  ### Could not find "ControlledProc" as a program symbol
  2362.  
  2363.  See also    Proc, Func, Macro, Define
  2364. -
  2365. Untrace -remove tracepoints
  2366.  Syntax    
  2367.      untrace addr ,...
  2368.          or
  2369.      untrace trap ,... 
  2370.          or
  2371.      untrace trap-range ,... 
  2372.          or
  2373.      untrace all [ traps | addrs ]
  2374.         or
  2375.     untrace class <classname>
  2376.         or
  2377.     untrace overload <functionname>
  2378.  
  2379.  Description
  2380.      The Untrace command clears the tracepoint; at the specified addresses 
  2381.  or traps. The all keyword clears all tracepoints within the target program. 
  2382.  The all keyword  can optionally be followed by the traps or addrs keywords 
  2383.  to restrict the command to traps or addresses respectively.
  2384.      The class keyword is used to clear tracepoints on all routines associated
  2385.  with the specified class.  The overload keyword is used to clear tracepoints
  2386.  on all routines of the specified name in all classes.
  2387.  
  2388.  Example
  2389.  
  2390.  untrace _GetResource    #undo trace on _GetResource trap
  2391.  
  2392.  See also    Trace
  2393. -
  2394. Version -display SADE version information
  2395.  Syntax    
  2396.      version
  2397.  
  2398.  Description
  2399.      The Version command displays the current SADE version number.
  2400. -
  2401. Where (addr)    
  2402.     Returns a string with a symbolic represenation of the specified address
  2403.  (if possible).  If SADE is not able to determine a symbolic representation,
  2404.  the hex representation of the address is returned.
  2405. -
  2406. While ...End -conditionally repeat commands
  2407.  Syntax    
  2408.      while  Boolean [ do ]
  2409.          commands
  2410.      end
  2411.  
  2412.  Description    
  2413.      The While...End; construct provides conditional looping; with a test
  2414.  at the beginning of the loop. The enclosed commands are executed as  long 
  2415.  as Boolean is true. If the condition is false at the outset, the enclosed 
  2416.  commands are never executed.
  2417.      While constructs may be nested.
  2418.  
  2419.  Example
  2420.  
  2421.  define goSmall := 10
  2422.  while goSmall > -2 do
  2423.    while goSmall > 4 do
  2424.      while goSmall > 7 do
  2425.        printf "          Inner loop - goSmall = %d\n", goSmall
  2426.        goSmall := goSmall -1
  2427.      end
  2428.      printf "     Middle loop - goSmall = %d\n", goSmall
  2429.      goSmall := goSmall - 1
  2430.    end
  2431.    printf "Outer loop - goSmall = %d\n", goSmall
  2432.    goSmall := goSmall - 1
  2433.  end
  2434.   
  2435.  #-- output
  2436.  
  2437.            Inner loop - goSmall = 10
  2438.            Inner loop - goSmall = 9
  2439.            Inner loop - goSmall = 8
  2440.       Middle loop - goSmall = 7
  2441.       Middle loop - goSmall = 6
  2442.       Middle loop - goSmall = 5
  2443.  Outer loop - goSmall = 4
  2444.  Outer loop - goSmall = 3
  2445.  Outer loop - goSmall = 2
  2446.  Outer loop - goSmall = 1
  2447.  Outer loop - goSmall = 0
  2448.  
  2449.  See also    Leave
  2450. -
  2451. WindowSize -set the size for new windows or for a 'zoomed' window.
  2452.  Syntax
  2453.      WindowSize Zoom|New [top, left, bottom, right]
  2454.  
  2455.  Description
  2456.      The WindowSize command allows you to set the size and position of newly 
  2457.  created windows, and to set the size and postion a window will take when the
  2458.  ZoomWindow button is clicked.
  2459.